package com.example.demo.controller;

import com.example.demo.model.CompanyInfo;
import com.example.demo.service.CompanyInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/api")
public class CompanyController {
    @Autowired
    private CompanyInfoService companyInfoService;

    @PostMapping("/login")
    public String login(@RequestParam String email, @RequestParam String password) {
        // 登录代码保持不变
        return email;
    }

    @GetMapping("/company-info")
    public List<CompanyInfo> getCompanyInfo(@RequestParam String companyName) {
        return companyInfoService.getCompanyInfo(companyName);
    }

    @PostMapping("/update-job")
    public String updateJob(@RequestBody CompanyInfo companyInfo) {
        companyInfoService.updateCompanyInfo(companyInfo);
        return "Update successful";
    }
}